<html><head><title>A function to select values of hyperparameters in a GAMLSS model</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>find.hyper(gamlss)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   find.hyper">
<param name="keyword" value=" A function to select values of hyperparameters in a GAMLSS model">
</object>


<h2>A function to select values of hyperparameters in a GAMLSS model</h2>


<h3>Description</h3>

<p>
This function selects the values of hyper parameters and/or non-linear parameters in a GAMLSS model. It uses the <font face="Courier New,Courier" color="#666666"><b>R</b></font>{} function <code>optim</code> 
which then minimised the generalized Akaike information criterion (GAIC) with a user defined penalty.
</p>


<h3>Usage</h3>

<pre>
find.hyper(model = NULL, parameters = NULL, other = NULL, penalty = 2,
        steps = c(0.1), lower = -Inf, upper = Inf, method = "L-BFGS-B",
        ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>model</code></td>
<td>
this is a GAMLSS model. e.g. <br>
<code>model=gamlss(y~cs(x,df=p[1]),sigma.fo=~cs(x,df=p[2]),data=abdom)</code> 
where p[1] and p[2] denore the parametets to be estimated</td></tr>
<tr valign="top"><td><code>parameters</code></td>
<td>
the starting values in the search of the optimum hyperparameters and/or non-linear parameters e.g. <code>parameters=c(3,3)</code>  </td></tr>
<tr valign="top"><td><code>other</code></td>
<td>
this is used to optimize other non-parameters, for example a transformation of the explanatory variable of the kind <i>x^p[3]</i>,
<code>others=quote(nx&lt;-x^p[3])</code> where nx is now in the model formula </td></tr>
<tr valign="top"><td><code>penalty</code></td>
<td>
specifies the penalty in the GAIC, (the default is 2 e.g. <code>penalty=3</code></td></tr>
<tr valign="top"><td><code>steps</code></td>
<td>
the steps taken in the optimization procedure [see the ndeps option in <code>optim()</code>], by default is set to 0.1 for all hyper parameters and non-linear parameters</td></tr>
<tr valign="top"><td><code>lower</code></td>
<td>
the lower permissible level of the parameters  i.e. <code>lower=c(1,1)</code> this does not apply if a method other than the default method "L-BFGS-B" is used </td></tr>
<tr valign="top"><td><code>upper</code></td>
<td>
the upper permissible level of the parameters  i.e. <code>upper=c(30,10)</code>, this is not apply if a method other than the default method "L-BFGS-B" is used </td></tr>
<tr valign="top"><td><code>method</code></td>
<td>
the method used in <code>optim()</code> to numerically minimize the GAIC over the hyperparameters and/or non-linear parameters.  By default this is "L-BFGS-B" to allow box-restriction on the parameters </td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
for extra arguments to be passed to the <code>R</code> function <code>optim()</code> used in the optimization</td></tr>
</table>

<h3>Details</h3>

<p>
This is an experimental function which appears to work well for the search of the optimum degrees of freedom and non-linear parameters 
(e.g. power parameter <i>lambda</i> used to transform x to <i>x^lambda</i>). 
Further investigation will check whether this function is reliable in general.
</p>


<h3>Value</h3>

<p>
The function turns the same output as the function <code>optim()</code>
</p>
<table summary="R argblock">
<tr valign="top"><td><code>par</code></td>
<td>
the optimum hyperparameter values</td></tr>
<tr valign="top"><td><code>value</code></td>
<td>
the minimized value of the GAIC</td></tr>
<tr valign="top"><td><code>counts</code></td>
<td>
A two-element integer vector giving the number of calls to `fn' and `gr' respectively </td></tr>
<tr valign="top"><td><code>convergence</code></td>
<td>
An integer code. `0' indicates successful convergence. see the function <code>optim()</code> for other errors</td></tr>
<tr valign="top"><td><code>message</code></td>
<td>
A character string giving any additional information returned by the optimizer, or `NULL'</td></tr>
</table>

<h3>Warning</h3>

<p>
It may be slow to find the optimum
</p>


<h3>Author(s)</h3>

<p>
Mikis Stasinopoulos
</p>


<h3>References</h3>

<p>
Rigby, R. A. and  Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), 
<EM>Appl. Statist.</EM>, <B>54</B>, part 3, pp 507-554.
</p>
<p>
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R.
Accompanying documentation in the current GAMLSS  help files, (see also  <a href="http://www.gamlss.com/">http://www.gamlss.com/</a>).
</p>
<p>
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
<EM>Journal of Statistical Software</EM>, Vol. <B>23</B>, Issue 7, Dec 2007, <a href="http://www.jstatsoft.org/v23/i07">http://www.jstatsoft.org/v23/i07</a>.
</p>


<h3>See Also</h3>

<p>
<code><a href="gamlss.html">gamlss</a></code>, <code><a href="plot.gamlss.html">plot.gamlss</a></code>, <code><a onclick="findlink('stats', 'optim.html')" style="text-decoration: underline; color: blue; cursor: hand">optim</a></code>
</p>


<h3>Examples</h3>

<pre>
data(abdom)
attach(abdom)
# declare the model
mod1&lt;-quote(gamlss(y~cs(nx,df=p[1]),family=BCT,data=abdom,
                        control=gamlss.control(trace=FALSE)))
# we want also to check for a transformation in x 
# so we use the other option
op&lt;-find.hyper(model=mod1, other=quote(nx&lt;-x^p[2]), parameters=c(3,0.5), 
            lower=c(1,0.001), steps=c(0.1,0.001))
# the optimum parameters found are 
# p=(p[1],p[2]) = (2.944836 0.001000) = (df for mu, lambda)
# so it needs df = 3 on top of the constant and linear 
# in  the cubic spline model for mu since p[1] is approximately  3
# and log transformation for x since p[2] is approximately  0 
op
rm(op)
</pre>

<script Language="JScript">
function findlink(pkg, fn) {
var Y, link;
Y = location.href.lastIndexOf("\\") + 1;
link = location.href.substring(0, Y);
link = link + "../../" + pkg + "/chtml/" + pkg + ".chm::/" + fn;
location.href = link;
}
</script>


<hr><div align="center">[Package <em>gamlss</em> version 1.9-1 <a href="00Index.html">Index]</a></div>

</body></html>
